package com.ruoyi.loan.loan.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @author 杰少
 * @version 6.6.6
 * @description: TODO
 * @date 2023/1/14 12:54
 */
@Slf4j
public class LoanMoneyUtils {

    // 返回计算的金额 (月+金额+时间)
    public static Double loanMoney(Double rate , Double money , Integer term){

        // 年利率
        Double yearRate = rate * 12;
        // 年数量
        Integer yearNum = term / 12;
        // 月数量
        Integer monthNum = term % 12;

        // 总金额
        Double countMoney=money + (money * yearNum * yearRate ) + ( money * monthNum * rate );

        return countMoney;
    }
}
